﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;

namespace METU_CMT.Business
{
    public class User
    {
        private int userId;
        private string userName;
        private string passWord;
        private string name;
        private string surname;
        private string email;
        private string photoFile;
        private string userType;

        public int UserId
        {
            get { return userId; }
            set { userId = value; }
        }

        public string UserName
        {
            get { return userName; }
            set { userName = value; }
        }

        public string PassWord
        {
            get { return passWord; }
            set { passWord = value; }
        }

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public string Surname
        {
            get { return surname; }
            set { surname = value; }
        }

        public string Email
        {
            get { return email; }
            set { email = value; }
        }

        public string PhotoFile
        {
            get { return photoFile; }
            set { photoFile = value; }
        }

        public string UserTypeField
        {
            get { return userType; }
            set { userType = value; }
        }

        public virtual void GoToProfilePage( HttpResponse response )
        {
            //TODO: Not Implemented
        }


        public void SetProfileInfo(string username, string password, string eMail, string photofile)
        {
            UserName = username;
            Email = eMail;
            if(string.IsNullOrEmpty(photofile) == false)
            {
                PhotoFile = photofile;
            }

            UsersTableAdapter _usersTableAdapter = new UsersTableAdapter();
            _usersTableAdapter.UpdateProfileInfo(username, password, eMail, photofile);
        }

        public void InsertImage(string photoPath)
        {
            UsersTableAdapter _usersTableAdapter = new UsersTableAdapter();
            _usersTableAdapter.InsertImage(photoPath);
        }

        public virtual void SetHome(MenuItem menuItem)
        {
            //TODO: Not Implemented
        }
    }
}
